/*
 * @lc app=leetcode.cn id=453 lang=cpp
 *
 * [453] 最小操作次数使数组元素相等
 */

// @lc code=start
class Solution {
public:
    int minMoves(vector<int>& nums) {
      int n = nums.size();
      if (n == 1)
        return 0;
      return accumulate(nums.begin(), nums.end(), 0) - n * (*min_element(nums.begin(), nums.end()));
    }
};
// @lc code=end

